//
//  RecommendRadioListView.m
//  RainbowFM
//
//  Created by Kratos on 14/12/9.
//  Copyright (c) 2014年 RB. All rights reserved.
//

#import "RecommendRadioListView.h"
#import "RecommendRadioView.h"


@interface RecommendRadioListView()

@property (nonatomic , strong) NSMutableArray *radioList;//电台信息

@end

@implementation RecommendRadioListView

- (void)awakeFromNib {
    _radioList = [NSMutableArray array];
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)updateRadioListData:(NSArray *)radioList;
{
    [_radioList removeAllObjects];
    [_radioList addObjectsFromArray:radioList];
    
    [_partnersScrollView reloadData];
}

#pragma mark -SwipeViewDataSource
- (NSInteger)numberOfItemsInSwipeView:(SwipeView *)swipeView
{
    return [_radioList count];
}

- (UIView *)swipeView:(SwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view
{
    RecommendRadioView *radioView = (RecommendRadioView *)view;
    if (!radioView) {
        radioView = _LoadXib(RecommendRadioView,nil,nil);
        
        view = radioView;
    }
    
    [radioView updateContent:_radioList[index]];
    
    return view;
}

#pragma mark - SwipeViewDelegate
- (void)swipeViewCurrentItemIndexDidChange:(SwipeView *)swipeView
{
    if ([_delegate respondsToSelector:@selector(currentItemIndexDidChange:view:)]) {
        [_delegate currentItemIndexDidChange:swipeView.currentItemIndex view:self];
    }
}

- (void)swipeView:(SwipeView *)swipeView didSelectItemAtIndex:(NSInteger)index
{
    if ([_delegate respondsToSelector:@selector(didSelectItemAtIndex:view:)]) {
        [_delegate didSelectItemAtIndex:index view:self];
    }
}


@end
